package com.houxiurong.dao;

import com.houxiurong.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/**
 * Created by houxiurong on 2017/6/29.
 */
public interface UserDAO extends JpaRepository<User,Integer>{

    User findByName(String name);

    User findByNameAndAge(String name, Integer age);

    @Query("From User u where u.name=:name")
    User findUserByName(@Param("name") String name);

    Page<User> findByNameNot(String name, Pageable pageable);
}
